package com.itcaius.weblog.common.domain.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itcaius.weblog.common.domain.dos.UserRoleDO;

import java.util.List;

/**
 * @author Caius
 * @description
 * @since Created in 2025-04-20
 */
public interface UserRoleMapper extends BaseMapper<UserRoleDO> {
    /**
     * 根据用户名查询角色权限列表
     * @param username 用户名
     * @return 用户权限列表
     */
    default List<UserRoleDO> selectByUsername(String username){
        LambdaQueryWrapper<UserRoleDO> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(UserRoleDO::getUsername, username);

        return selectList(wrapper);
    }
}
